﻿// See https://aka.ms/new-console-template for more information
using MediatorPattern.Character;
using MediatorPattern.Mediator;

Console.WriteLine("Hello, World!");

/*
 * 1 中介者模式：（Mediator Pattern）
 * 2 中介者模式优缺点
 * 3 数据库设计的中介者模式
 */ 

BaseCharacter teacher = new Teacher() { Name = "wja老师" };
BaseCharacter master = new Master() { Name = "李四班长" };
BaseCharacter student = new Student() { Name = "张三" };
BaseCharacter student1 = new Student() { Name = "李四" };
BaseCharacter student2 = new Student() { Name = "王五" };
BaseCharacter student3 = new Student() { Name = "赵六" };


string message = "今天晚上VIP课，通知大家上课";
teacher.SendMessage(message, master);
Console.WriteLine("**************************************");
string message2 = "今天晚上VIP课,记得来上课";
//master.SendMessage(message2, student);
//master.SendMessage(message2, student1);
//master.SendMessage(message2, student2);
//master.SendMessage(message2, student3);

Console.WriteLine("*******************使用中介者*******************");

BaseMediator mediator = new BaseMediator();
mediator.AddCharacter(teacher);
mediator.AddCharacter(master);
mediator.AddCharacter(student);
mediator.AddCharacter(student1);
mediator.AddCharacter(student2);
mediator.AddCharacter(student3);
mediator.SendMessage(message2, master);
